package com.cambright.lotusroot
{
	import com.cambright.IDispose;
	
	import flash.crypto.generateRandomBytes;
	import flash.utils.ByteArray;
	
	import avmplus.getQualifiedClassName;

	public class WidgetKey implements IDispose
	{
		private var _key:String;
		private var _module:Module;
		private var _str:String;
		
		public function WidgetKey(module:Module)
		{
			var byteArray:ByteArray = generateRandomBytes(128);
			byteArray.position = 0;
			_key = byteArray.readUTFBytes(byteArray.bytesAvailable);
			_module = module;
			_str = "[WidgetKey][" + _key + "][" + getQualifiedClassName(_module) + "]";
		}
		
		public function dispose():void
		{
			_key = null;
			_module = null;
			_str = null;
		}
		
		public function toString():String
		{
			return _str;
		}
	}
}